package com.woniu.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultCom<T> {

    private int code;
    private String msg;
    private T data;

    public ResultCom(T data) {
    }

    public static <T> ResultCom success(String msg, T data){
        ResultCom res = new ResultCom(200,msg, data);
        return res;
    }
    public static <T> ResultCom success(T data){
        ResultCom res = new ResultCom(data);
        res.setCode(200);
        res.setMsg("成功了");
        return res;
    }
    public static ResultCom success(String msg){
        ResultCom res = new ResultCom(200,msg,null);
        return res;
    }

   public static ResultCom error( String msg){
       ResultCom res = new ResultCom(500, msg, null);
       return  res;
   }
}
